# contains shared model/scope mapping functions
from myelin.rdf.bindery.Mappings import IdentityMap, \
    FlatMapO, FlatMapS, \
    ExtMap, IdRangeExtMap, \
    ScopeMap

# Resource mappings
BaseMap                 = IdentityMap()
TypesMap                     = ExtMap('types')

# Document mappings
DocumentMap             = ExtMap('document')
#DocumentBodyMap         = ExtMap('body')

RelationsMap            = ExtMap('relations')

DocTranslationMap       = FlatMapO()
DocContainedByMap       = RelationsMap

DocIsPartOfMap          = RelationsMap
DocTranslationOfMap     = DocContainedByMap
DocParentMap            = DocContainedByMap
DocGroupingMap          = DocIsPartOfMap

# Container mappings
ContainerMap            = ExtMap('container')
ContainsMap             = FlatMapO()
ContainsUnpublishedMap  = FlatMapO()
ContainsExpiredMap      = FlatMapO()

# Node Grouping
NodeGroupingMap         = FlatMapO()

# Agent mappings
AgentAccountMap         = ExtMap('account')

AgentMap                = ExtMap('agent')
AgentMembershipMap      = IdRangeExtMap('memberships',-5)

PrimaryTopicMap         = FlatMapS()
#AgentProfilesMap        = lambda id, pred, scope: [id[:-5] + 'profiles']

AccountPreferencesMap   = FlatMapS()
UserPreferencesMap      = ExtMap('settings')

# Agent Profiles
AgentProfileMap         = ExtMap('agent-profile')
AgentDepictionMap       = ExtMap('depiction')

# Source File
#FileMap                 = ExtMap('file')
SourceFileMap               = RelationsMap

# Error Document
ErrorDocumentMap        = ExtMap('error-document')

# Rules
RuleMap                 = FlatMapS()

# Schema
SchemaMap               = ExtMap('schema')
SchemaRelationsMap      = ExtMap('schema-relations')
SchemaSetsMap           = ExtMap('schema-sets')
SchemaHierarchyMap      = ExtMap('schema-hierarchy')
TrustMap                = ExtMap('trust')

DomainOfMap             = FlatMapO()
RangeOfMap              = FlatMapO()
IsDefinedByOfMap        = FlatMapS()

ServiceMap              = ExtMap('service')

GraphMap                = ExtMap('graph')
GraphTypesMap           = ExtMap('graph-types')

TextIndexMap            = ExtMap('text-index')
IndexTypesMap           = ExtMap('index-types')